Home | Trees | Index | Help |
|
---|
Package lemon :: Package external :: Package Cheetah :: Module Template :: Class Template |
|
BaseServlet
--+ |Servlet
--+ |_SettingsCollector
--+ | | |SettingsManager
--+ |WebInputMixin
--+ | Template
The core template engine. It serves as a base class for Template servlets and also knows how to compile a template.
Method Summary | |
---|---|
Reads in the template definition, sets up the namespace searchList, processes settings, then compiles. | |
Compile the template. | |
Return a reference to the current errorCatcher... | |
Return the class code the compiler generated, or None if no compilation took place. | |
Return the module code the compiler generated, or None if no compilation took place. | |
A hook for getting the contents of a file. | |
Get a variable from the searchList. | |
Test if a variable name exists in the searchList. | |
Refresh a cache item. | |
Allows enable the Template to function as a standalone command-line program for static page generation. | |
Return a reference to the searchlist... | |
Break reference cycles before discarding a servlet. | |
Test if a variable name exists in the searchList. | |
Called by the Compiler class, to add new methods at runtime as the compilation process proceeds. | |
Used to dynamically bind a plain function as a method of the Template instance. | |
Generate a temporary file name. | |
Imports a python .py module as if it were part of the package given by 'packageName'. | |
Used by the Compiler to do correct importing from Cheetah templates when the template is compiled via the Template class' interface rather than via 'cheetah compile'. | |
Imports the given module from the given directory. | |
This is the method that #include directives translate into. | |
Returns a Python Package that thinks it came from 'dirName'. | |
Inherited from SettingsManager | |
Returns a shallow copy of the settings dictionary... | |
Returns a deep copy of the settings dictionary... | |
Return a string with the settings in .ini file format. | |
True/False... | |
Set a setting in self._settings. | |
Get a setting from self._settings, with or without a default value. | |
Return a reference to the settings dictionary... | |
Update the settings with a selective merge or a complete overwrite. | |
Update the settings from a text file using the syntax accepted by Python's standard ConfigParser module (like Windows .ini files). | |
See the docstring for .updateSettingsFromConfigFile() The caller of this method is responsible for closing the inFile file object. | |
See the docstring for .updateSettingsFromConfigFile()... | |
Update the settings from variables in a Python source file. | |
Update the settings from a code in a Python src string. | |
Write all the settings that can be represented as strings to an .ini style config file. | |
Write all the settings that can be represented as strings to an .ini style config string. | |
| |
A hook that allows for complex setting initialization sequences that involve references to 'self' or other settings. | |
Inherited from _SettingsCollector | |
Extract all the attributes of a SettingsContainer subclass. | |
Check if 'thing' is a Python module or a subclass of SettingsContainer. | |
A hook for any neccessary path manipulations. | |
| |
Return the settings from a config file that uses the syntax accepted by Python's standard ConfigParser module (like Windows .ini files). | |
Returns all settings from a SettingsContainer or Python module. | |
Returns all settings from a SettingsContainer or Python module. | |
Return new settings dict from variables in a Python source file. | |
Return a dictionary of the settings in a Python src string. | |
Inherited from Servlet | |
| |
| |
| |
| |
| |
Inherited from WebInputMixin | |
Import web transaction variables in bulk. |
Class Variable Summary | |
---|---|
list |
_legalKWs = ['_globalSetVars', '_preBuiltSearchList']
|
Inherited from _SettingsCollector | |
lock |
_sysPathLock = <thread.lock object at 0x008AD160>
|
Inherited from Servlet | |
NoneType |
application = None |
NoneType |
request = None |
NoneType |
session = None |
NoneType |
transaction = None |
Inherited from BaseServlet | |
int |
_reusable = 1 |
int |
_threadSafe = 0 |
Method Details |
---|
__init__(self,
source=None,
searchList=[],
file=None,
settings={},
filter='ReplaceNone',
filtersLib=<module 'lemon.external.Cheetah.Filters' from 'C:\Work\Le...,
errorCatcher=None,
compilerSettings={},
**KWs)
|
compile(self, source=None, file=None, moduleName=None, mainMethodName='respond')Compile the template. This method is automatically called by __init__ when __init__ is fed a file or source string. |
errorCatcher(self)Return a reference to the current errorCatcher |
generatedClassCode(self)Return the class code the compiler generated, or None if no compilation took place. |
generatedModuleCode(self)Return the module code the compiler generated, or None if no compilation took place. |
getFileContents(self, path)A hook for getting the contents of a file. The default implementation just uses the Python open() function to load local files. This method could be reimplemented to allow reading of remote files via various protocols, as PHP allows with its 'URL fopen wrapper' |
getVar(self, varName, default=<class lemon.external.Cheetah.Template.NoDefault at 0x00E..., autoCall=True)Get a variable from the searchList. If the variable can't be found in the searchList, it returns the default value if one was given, or raises NameMapper.NotFound. |
hasVar(self, varName, autoCall=True)Test if a variable name exists in the searchList. |
refreshCache(self, cacheKey=None)Refresh a cache item. |
runAsMainProgram(self)Allows enable the Template to function as a standalone command-line program for static page generation. Type 'python yourtemplate.py --help to see what it's capabable of. |
searchList(self)Return a reference to the searchlist |
shutdown(self)Break reference cycles before discarding a servlet. |
varExists(self, varName, autoCall=True)Test if a variable name exists in the searchList. |
_bindCompiledMethod(self, methodCompiler)Called by the Compiler class, to add new methods at runtime as the compilation process proceeds. |
_bindFunctionAsMethod(self, function)Used to dynamically bind a plain function as a method of the Template instance. |
_genTmpFilename(self)Generate a temporary file name. This is used internally by the Compiler to do correct importing from Cheetah templates when the template is compiled via the Template class' interface rather than via 'cheetah compile'. |
_impModFromDummyPackage(self, packageName, pathToImport)Imports a python .py module as if it were part of the package given by 'packageName'. The package doesn't need to exist. |
_importAsDummyModule(self, contents)Used by the Compiler to do correct importing from Cheetah templates when the template is compiled via the Template class' interface rather than via 'cheetah compile'. |
_importModuleFromDirectory(self, fullModuleName, moduleName, directory, isPackageDir=0, forceReload=0)Imports the given module from the given directory. fullModuleName should be the full dotted name that will be given to the module within Python (including the packages, etc.). moduleName should be the name of the module in the filesystem, which may be different from the name given in fullModuleName. Returns the module object. If forceReload is true then this reloads the module even if it has already been imported. If isPackageDir is true, then this function creates an empty __init__.py if that file doesn't already exist. |
_includeCheetahSource(self, srcArg, trans=None, includeFrom='file', raw=False, _includeID=None)This is the method that #include directives translate into. |
_makeDummyPackageForDir(self, dirName)Returns a Python Package that thinks it came from 'dirName'. |
Class Variable Details |
---|
_legalKWs
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Mon Nov 10 15:07:55 2003 | http://epydoc.sf.net |